﻿using Infrastructure.Web;
using MyWeb.App_Start;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MyWeb.Controllers
{
    public class SyncErrorController : BaseController
    {
        [HandlerLogin]
        // GET: SyncError
        public ActionResult SyncErrorIndex()
        {
            ViewBag.Mobiles = mobileApp.GetMobiles();
            return View();
        }

        public ActionResult GetSyncErrors(QueryListModel query, Guid mobileId, string StartDate, string EndDate)
        {
            DateTime startDate = DateTime.Parse(StartDate).Date;
            DateTime endDate = DateTime.Parse(EndDate).Date.AddDays(1);
            var result = SyncErrorApp.GetSyncErrors(query, mobileId, startDate, endDate);
            return Json(result, JsonRequestBehavior.AllowGet);
        }
        [HttpPost]
        public JsonResult SyncErrorBatchDelete(List<Guid> Ids)
        {
            return base.Try(() =>
            {
                SyncErrorApp.SyncErrorBatchDelete(Ids);
            });
        }
        [HttpPost]
        public JsonResult SyncErrorRepeate(Guid Id)
        {
            return base.Try(() =>
            {
                SyncErrorApp.SyncErrorRepeate(Id);
            });
        }

    }
}